import { Controller, Get, Query, UseInterceptors } from "@nestjs/common";
import { DeviceService } from "./device.service";
import { CacheInterceptor } from "@nestjs/cache-manager";
import { ApiOperation, ApiTags } from "@nestjs/swagger";
import { ApiRes } from "src/decorator";

@ApiTags("Device - 系统信息模块")
@UseInterceptors(CacheInterceptor)
@Controller("device")
export class DeviceController {
    constructor(private readonly deviceService: DeviceService) {}

    @ApiOperation({ summary: "CPU 信息" })
    @ApiRes({ type: Object })
    @Get("cpu_info")
    async cpuInfo() {
        return await this.deviceService.cpuInfo();
    }

    @ApiOperation({ summary: "系统信息" })
    @ApiRes({ type: Object })
    @Get("os_info")
    async osInfo() {
        return await this.deviceService.osInfo();
    }

    @ApiOperation({ summary: "存储信息" })
    @ApiRes({ type: Object })
    @Get("fs_size")
    fsSize(@Query("drive") drive?: string) {
        return this.deviceService.fsSize(drive);
    }
}
